package com.cos.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.cos.commons.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.cos.entity.OrderDetailEntity;
import com.cos.service.OrderDetailService;




/**
 * 
 *
 * @author lyc
 * @email 2102@qq.com
 * @date 2021-07-20 19:17:04
 */
@RestController
@RequestMapping("/orderdetail")
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public List<OrderDetailEntity> list(@RequestParam Map<String, Object> params){


        return null;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		OrderDetailEntity orderDetail = orderDetailService.getById(id);

        return R.success();
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OrderDetailEntity orderDetail){
		orderDetailService.save(orderDetail);

        return R.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrderDetailEntity orderDetail){
		orderDetailService.updateById(orderDetail);

        return R.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		orderDetailService.removeByIds(Arrays.asList(ids));

        return R.success();
    }

}
